package com.open.rbac.model.vo.id;

import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import com.open.rbac.constant.GenderType;
import com.open.rbac.constant.IdType;
import com.open.rbac.model.vo.id.group.IdentityUpdate;


@ToString
@Schema(name = "IdentityVo", description = "Id Vo")
@Getter
@Setter
@NoArgsConstructor
public class IdentityVo {

    @Schema(description = "Id")
    @NotBlank(message = "Id为必填项", groups = IdentityUpdate.class)
    @Length(min = 36, max = 36, message = "Id长度为36个字符", groups = IdentityUpdate.class)
    private String id;

    @Schema(description = "姓名")
    @NotBlank(message = "姓名为必填项")
    @Size(min = 1, max = 100, message = "姓名长度在 1~100 之间")
    private String name;

    @Schema(description = "性别，取值：Male/Female")
    @NotNull(message = "性别为必选项，且取值只能为 Male/Female")
    private GenderType gender;

    @Schema(description = "民族")
    @Size(max = 64, message = "民族最大长度为64个字符")
    private String ethnicity;

    @Schema(description = "证件类型，取值：Identity/Military/Passport")
    @NotNull(message = "证件类型为必选项")
    private IdType idType;

    @Schema(description = "证件号码")
    @Size(max = 64, message = "证件号码最大长度为64个字符")
    // @Pattern(regexp = "\\d{15}(\\d{2}[0-9xX])?", message = "证件号码不符合规则")
    private String idNumber;

    @Schema(description = "手机")
    @Pattern(regexp = "^[1][3,5,7,8][0-9]\\d{8}$", message = "手机号码不符合规则")
    private String phone;

    @Schema(description = "职业")
    @Size(max = 64, message = "职业最大长度为64个字符")
    private String job;

    @Schema(description = "工作单位")
    @Size(max = 255, message = "工作单位最大长度为255个字符")
    private String workplace;

    @Schema(description = "户籍地址")
    @Size(max = 255, message = "户籍地址最大长度为255个字符")
    private String nativePlace;

    @Schema(description = "现住址")
    @Size(max = 255, message = "现住址地址最大长度为255个字符")
    private String address;

    @Schema(description = "备注")
    @Size(max = 255, message = "备注最大长度为255个字符")
    private String remark;

    @Schema(description = "所属组织机构")
    private List<String> organizationIds;

    @Schema(description = "关系")
    private IdentityRelVo rel;

}
